#include<avr/io.h>
#include<avr/eeprom.h>
#include"variable.h"


void UDCHPA_to_SPC(void)
{
	uint16 UDC_UP_Mid_frq;
	uint16 UDC_DOWN_Mid_frq;

	
				UDC_UP_Mid_frq = (UDC_RX_BUFF[5]*256U);
				UDC_DOWN_Mid_frq = (UDC_RX_BUFF[10]*256U);
			     UDC_RX_UP_FREQUENCY = ( UDC_UP_Mid_frq | UDC_RX_BUFF[4] );
				UDC_RX_DOWN_FREQUENCY = ( UDC_DOWN_Mid_frq | UDC_RX_BUFF[9] );

				
				if(UDC_RX_BUFF[6] == 0x14U )
				{
					switch(UDC_RX_UP_FREQUENCY)
					{

					    case 0x9055U:
							SPC_TX_BUFF[8] = 0x09U;
						break;
				
						case 0x9115U:
							SPC_TX_BUFF[8] = 0x0AU;

						break;
				
						case 0x9175U:
							SPC_TX_BUFF[8] = 0x0BU;
						break;

						case 0x9235U:
							SPC_TX_BUFF[8] = 0x0CU;
						break;

						case 0x9295U:
							SPC_TX_BUFF[8] = 0x0DU;
						break;

						case 0x9355U:
							SPC_TX_BUFF[8] = 0x01U;
						break;

						case 0x9415U:
							SPC_TX_BUFF[8] = 0x02U;
						break;

						case 0x9475U:
							SPC_TX_BUFF[8] = 0x03U;
						break;

						case 0x9535U:
							SPC_TX_BUFF[8] = 0x04U;
						break;

						case 0x9595U:
							SPC_TX_BUFF[8] = 0x05U;
						break;

						case 0x9655U:
							SPC_TX_BUFF[8] = 0x06U;
						break;

						case 0x9715U:
							SPC_TX_BUFF[8] = 0x07U;
						break;

						case 0x9775U:
							SPC_TX_BUFF[8] = 0x08U;
						break;

                        default:
                        break;
	
					}
				
				}


					if( UDC_RX_BUFF[11] == 0x15U )
					{ 

						switch(UDC_RX_DOWN_FREQUENCY)
						{

						case 0x0735U:
								SPC_TX_BUFF[7] = 0x01U;
							break;
				
							case 0x0795U:
								SPC_TX_BUFF[7] = 0x02U;
							break;
				
							case 0x0855U:
								SPC_TX_BUFF[7] = 0x03U;
							break;

							case 0x0915U:
								SPC_TX_BUFF[6] = 0x04U;
							break;

							case 0x0975U:
								SPC_TX_BUFF[7] = 0x05U;
							break;

							case 0x1035U:
								SPC_TX_BUFF[7] = 0x06U;
							break;

							case 0x1095U:
								SPC_TX_BUFF[7] = 0x07U;
							break;

							case 0x1155U:
								SPC_TX_BUFF[7] = 0x08U;
							break;

							case 0x1215U:
								SPC_TX_BUFF[7] = 0x09U;
							break;

							case 0x1275U:
								SPC_TX_BUFF[7] = 0x0AU;
							break;

							case 0x1335U:
								SPC_TX_BUFF[7] = 0x0BU;
							break;

							case 0x1395U:
								SPC_TX_BUFF[7] = 0x0CU;
							break;

							case 0x1455U:
								SPC_TX_BUFF[7] = 0x0DU;
							break;

                            default:
                            break;
	
						}
			
					}


}
